home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Very Best of Atari Inside
/
The Very Best of Atari Inside 1.iso
/
mint
/
mntlib43
/
mntlib
/
gets.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-17
|
368b
|
25 lines
#include <stdio.h>
#include <assert.h>
char *gets(data)
register char *data;
{
register char *p = data;
register int c;
assert((data != NULL));
while(((c = getc(stdin)) != EOF) && (c != '\n'))
{
if(c == '\b')
{
if(p > data)
--p;
}
else
*p++ = c;
}
*p = '\0';
return(((c == EOF) && (p == data)) ? NULL : data); /* NULL == EOF */
}